export default {
  // addCount(state,payload){
  //   payload.count++
  // },
  // addToCart(state,payload){
  //   payload.count = 1;
  //   this.context.Cart.push(payload)
  // },
  addCart(state, payload){
    //数组find()方法
    let oldProduct = state.Cart.find( item => item.iid === payload.iid)
    if(oldProduct){
      oldProduct.count += 1;
    }else {
        payload.count = 1;
        state.Cart.push(payload)
    }
  }
}